﻿#include "B7CutMainWindow.h"
#include <QStandardPaths>
#include <QDate>
#include "MessageLogger.h"
#include <QApplication>
#include <QSharedMemory>
#include <QMessageBox>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSharedMemory singleton(a.applicationName());
    if (!singleton.create(sizeof(int), QSharedMemory::ReadOnly))
    {
        QMessageBox::information(0, a.applicationName(), u8"本程序一个程序实例已经在运行中，不能同时运行两个实例！");
        exit(-1);
    }

    Qly::LoggerController logger;
    logger.attach(new Qly::FileLogger("stderr", true));
    QString path = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
    path = path + "/B7Cut_" + QDate::currentDate().toString("yyyyMMdd.txt");
    logger.attach(new Qly::FileLogger(path, true));
    logger.startLogging();
    B7CutMainWindow w;
    w.show();
    return a.exec();
}
